/**==================================================================
 * Copyright: Belongs to Cystc (org.cystc) 2013~2065
 * FileName: org.cystc.users.dao.impl.UserDaoImpl.java
 * Description: 
 * Changes: 
 * Date                Author           Note
 * ===================================================================
 * 2013-3-10    Cysct(cystc@126.com)     Create file,implement function
 **===================================================================*/
package org.cystc.users.dao.impl;

import java.util.List;

import org.cystc.common.dao.impl.BaseDaoImpl;
import org.cystc.users.dao.inter.UserDao;
import org.cystc.users.model.User;

public class UserDaoImpl extends BaseDaoImpl implements UserDao {

	public void add(User user) {
		getHibernateTemplate().save(user);
	}

	public void delete(User user) {
		getHibernateTemplate().delete(user);
	}

	public List<?> findAll() {
		return getHibernateTemplate().find("from User");
	}

	public List<?> findById(int id) {
		return getHibernateTemplate().find("from User where id=?", id);
	}

	public List<?> findByUsername(String username) {
		return getHibernateTemplate().find("from User where username=?",
				username);
	}

	public void update(User user) {
		getHibernateTemplate().update(user);
	}
}
